import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useUserStore = defineStore(
  'user',
  () => {
    const username = ref('zs')
    const setUsername = (str: string): void => {
      username.value = str
    }
    return { username, setUsername }
  },
  {
    // 所有数据持久化
    // persist: true
    // 部分数据持久化
    persist: {
      paths: ['username']
    }
  }
)
